package com.guoguo.generic;

import java.util.Arrays;

public class DemoOne {
    public static void main(String[] args) {
        Integer[] arr1 = {1,2,3,4,5,6};
        String[] arr2 = {"a","b","c","d","e","f"};
        System.out.println("arr1==" + Arrays.asList(change(arr1, 0, 5)));
        System.out.println("arr1==" + Arrays.asList(change(arr2, 0, 5)));
    }

    private static <T> T[] change(T[] t, Integer i, Integer j){
        T temp = t[i];
        t[i] = t[j];
        t[j] = temp;
        return t;
    }
}
